package com.hornsun.repository;

import com.hornsun.domain.dbo.MedicalRecord;
import com.hornsun.repository.mapper.MedicalRecordMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

/**
 * Created by 编译中... on 2018/2/5.
 */
@Repository
public class MedicalRecordRepository {
    @Autowired
    private MedicalRecordMapper medicalRecordMapper;

    public void insertMedicalRecord(MedicalRecord medicalRecord){
        int count = medicalRecordMapper.insertSelective(medicalRecord);
        if (count!=1){
            throw new RuntimeException("insert medical_record failed");
        }
    }

    public MedicalRecord getLastRecord(String memberGuid){
        return medicalRecordMapper.selectLastRecord(memberGuid);
    }
}
